<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>为一个 PHP 字符串值设置 xmlrpc 的类型、base64 或日期时间</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.xmlrpc-server-register-method.html">« xmlrpc_server_register_method</a></li>
      <li style="float: right;"><a href="refs.utilspec.windows.html">Windows 专用扩展 »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.xmlrpc.html">XML-RPC 函数</a></li>
    <li>为一个 PHP 字符串值设置 xmlrpc 的类型、base64 或日期时间</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.xmlrpc-set-type" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">xmlrpc_set_type</h1>
    <p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">xmlrpc_set_type</span> &mdash; <span class="dc-title">为一个 PHP 字符串值设置 xmlrpc 的类型、base64 或日期时间</span></p>

   </div>
 <div class="refsect1 description" id="refsect1-function.xmlrpc-set-type-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>xmlrpc_set_type</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$value</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$type</code></span>): <span class="type">bool</span></div>

    <p class="para rdfs-comment">
    为一个 PHP 字符串值设置 xmlrpc 的类型、base64 或日期时间
    </p>
     <div class="warning"><strong class="warning">警告</strong><p class="simpara">此函数是<em class="emphasis">实验性</em>的。此函数的表象，包括名称及其相关文档都可能在未来的
PHP 发布版本中未通知就被修改。使用本函数风险自担。</p></div>
   </div>


 <div class="refsect1 parameters" id="refsect1-function.xmlrpc-set-type-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">value</code></dt>

     <dd>

      <p class="para">
       Value to set the type
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">type</code></dt>

     <dd>

      <p class="para">
       &#039;base64&#039; or &#039;datetime&#039;
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.xmlrpc-set-type-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
   If successful, <code class="parameter">value</code> is converted to an object.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.xmlrpc-set-type-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5367">
    <p><strong>示例 #1 A <span class="function"><strong>xmlrpc_set_type()</strong></span> example</strong></p>
    <div class="example-contents"><p>
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$params&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"Ymd\TH:i:s"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">time</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">xmlrpc_set_type</span><span style="color: #007700">(</span><span style="color: #0000BB">$params</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'datetime'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">xmlrpc_encode</span><span style="color: #007700">(</span><span style="color: #0000BB">$params</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;params&gt;
&lt;param&gt;
 &lt;value&gt;
  &lt;dateTime.iso8601&gt;20090322T23:43:03&lt;/dateTime.iso8601&gt;
 &lt;/value&gt;
&lt;/param&gt;
&lt;/params&gt;
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.xmlrpc-set-type-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Issues E_WARNING with type unsupported by XMLRPC.
  </p>
 </div>


  </div></div></div></body></html>